import Vuex from "vuex"
import Vue from 'vue'
Vue.use(Vuex)
import todo from "./modules/todo.js"

const token = uni.getStorageSync('mini_token')

const store = new Vuex.Store({
	namespaced: true,

	modules: { todo: todo },

	state: {
		// token: process.env.NODE_ENV === 'development' ? '2e8745cc0dfb12f82d2762800f8fa8f5f947078a' : token
		token: token
	},

	actions: {
		store_token({ state }, token) {
			state.token = token;
			// 存储token
			uni.setStorageSync('mini_token', token);
		}
	},
})

export default store;